/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

/* 仪表盘容器 */
.dashboard {
    display: flex;
    min-height: 100vh;
}

/* 侧边栏样式 */
.sidebar {
    width: 250px;
    background-color: #2c3e50;
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar.collapsed {
    transform: translateX(-100%);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #34495e;
}

.sidebar-header h1 {
    font-size: 20px;
    font-weight: 600;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #bdc3c7;
    text-decoration: none;
    transition: all 0.3s ease;
    gap: 15px;
}

.nav-item:hover {
    background-color: #34495e;
    color: white;
}

.nav-item.active {
    background-color: #3498db;
    color: white;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid #34495e;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #3498db;
}

.user-details {
    flex: 1;
}

.user-name {
    font-weight: 500;
    font-size: 14px;
}

.user-role {
    font-size: 12px;
    color: #bdc3c7;
}

/* 主内容区 */
.main-content {
    flex: 1;
    margin-left: 250px;
    transition: margin-left 0.3s ease;
}

.main-content.expanded {
    margin-left: 0;
}

/* 顶部导航 */
.main-header {
    background-color: white;
    padding: 15px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.menu-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: #555;
    padding: 5px;
}

.search-box {
    position: relative;
}

.search-input {
    padding: 10px 15px 10px 40px;
    border: 1px solid #ddd;
    border-radius: 20px;
    width: 300px;
    transition: width 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: #3498db;
    width: 350px;
}

.search-btn {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #777;
    cursor: pointer;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.notifications-btn,
.settings-btn {
    background: none;
    border: none;
    color: #555;
    cursor: pointer;
    padding: 10px;
    position: relative;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.notifications-btn:hover,
.settings-btn:hover {
    background-color: #f5f5f5;
}

.notification-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    background-color: #e74c3c;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* 页面标题 */
.page-header {
    padding: 30px 25px 20px;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 5px;
}

.page-header p {
    color: #7f8c8d;
    font-size: 14px;
}

/* 统计卡片网格 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    padding: 0 25px 25px;
}

.stat-card {
    background-color: white;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.stat-icon.primary {
    background-color: #3498db;
}

.stat-icon.secondary {
    background-color: #9b59b6;
}

.stat-icon.success {
    background-color: #2ecc71;
}

.stat-icon.danger {
    background-color: #e74c3c;
}

.stat-icon.warning {
    background-color: #f39c12;
}

.stat-icon.info {
    background-color: #1abc9c;
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 24px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 14px;
    color: #7f8c8d;
    margin-bottom: 5px;
}

.stat-change {
    font-size: 12px;
    font-weight: 500;
}

.stat-change.positive {
    color: #2ecc71;
}

.stat-change.negative {
    color: #e74c3c;
}

/* 图表区域 */
.charts-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    padding: 0 25px 25px;
}

.chart-card {
    background-color: white;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.chart-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
}

.chart-controls {
    display: flex;
    gap: 5px;
}

.chart-period-btn,
.chart-filter-btn {
    padding: 5px 15px;
    border: 1px solid #ddd;
    background-color: white;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.chart-period-btn.active {
    background-color: #3498db;
    color: white;
    border-color: #3498db;
}

.chart-period-btn:hover:not(.active),
.chart-filter-btn:hover {
    background-color: #f8f9fa;
}

.chart-container {
    position: relative;
}

/* 仪表盘网格布局 */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    padding: 0 25px 25px;
}

/* 活动卡片 */
.activity-card,
.notifications-card {
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.card-header {
    padding: 20px 25px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
}

.view-all {
    color: #3498db;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.3s ease;
}

.view-all:hover {
    color: #2980b9;
}

.mark-all-read {
    color: #3498db;
    background: none;
    border: none;
    font-size: 14px;
    cursor: pointer;
    transition: color 0.3s ease;
}

.mark-all-read:hover {
    color: #2980b9;
}

/* 活动列表 */
.activity-list,
.notifications-list {
    max-height: 400px;
    overflow-y: auto;
}

.activity-item {
    padding: 15px 25px;
    display: flex;
    align-items: flex-start;
    gap: 15px;
    border-bottom: 1px solid #f5f5f5;
    transition: background-color 0.3s ease;
}

.activity-item:hover {
    background-color: #f8f9fa;
}

.activity-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.activity-content {
    flex: 1;
}

.activity-text {
    font-size: 14px;
    color: #2c3e50;
    margin-bottom: 5px;
}

.activity-time {
    font-size: 12px;
    color: #95a5a6;
}

/* 通知列表 */
.notification-item {
    padding: 15px 25px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border-bottom: 1px solid #f5f5f5;
    transition: background-color 0.3s ease;
    position: relative;
}

.notification-item:hover {
    background-color: #f8f9fa;
}

.notification-item.unread {
    background-color: #ebf5fb;
}

.notification-dot {
    width: 8px;
    height: 8px;
    background-color: #3498db;
    border-radius: 50%;
    margin-top: 8px;
    flex-shrink: 0;
}

.notification-content {
    flex: 1;
}

.notification-text {
    font-size: 14px;
    color: #2c3e50;
    margin-bottom: 5px;
}

.notification-time {
    font-size: 12px;
    color: #95a5a6;
}

/* 设置面板 */
.settings-panel {
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin: 0 25px 25px;
    overflow: hidden;
}

.settings-content {
    padding: 25px;
}

.setting-group {
    margin-bottom: 30px;
}

.setting-group h4 {
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 15px;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f5f5f5;
}

.setting-item label {
    font-size: 14px;
    color: #555;
}

.setting-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.setting-item select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: white;
    cursor: pointer;
}

.theme-options {
    display: flex;
    gap: 10px;
}

.theme-btn {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background-color: white;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.theme-btn.active {
    background-color: #3498db;
    color: white;
    border-color: #3498db;
}

.theme-btn:hover:not(.active) {
    background-color: #f8f9fa;
}

.save-settings-btn {
    padding: 12px 30px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.save-settings-btn:hover {
    background-color: #2980b9;
}

/* 通知侧边栏 */
.notifications-sidebar {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background-color: white;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 200;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

.notifications-sidebar.open {
    right: 0;
}

.close-sidebar {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #7f8c8d;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.close-sidebar:hover {
    background-color: #f5f5f5;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 150;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.sidebar-overlay.visible {
    opacity: 1;
    visibility: visible;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .charts-section,
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .search-input {
        width: 200px;
    }
    
    .search-input:focus {
        width: 250px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .chart-card {
        padding: 15px;
    }
    
    .notifications-sidebar {
        width: 100%;
        right: -100%;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stat-card,
.chart-card,
.activity-card,
.notifications-card,
.settings-panel {
    animation: fadeIn 0.5s ease-out;
}

/* 自定义滚动条 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}